import { http } from "@/utils/http";
import type { RequestResponse } from "./types";

export const sensitiveApi = {
  // 敏感疾病库-查询
  searchSensitiveDisease: (params: SensitiveDiseaseSearchParams) => {
    return http.request<RequestResponse<SensitiveDiseaseSearchData>>(
      "post",
      "/api/v1/hdl/app/tag/sensitiveDisease/search",
      { data: params }
    );
  },
  // 敏感疾病库-创建
  createSensitiveDisease: (params: SensitiveDiseaseItem) => {
    return http.request<RequestResponse<any>>(
      "post",
      "/api/v1/hdl/app/tag/sensitiveDisease/create",
      { data: params }
    );
  },
  // 敏感疾病库-更新
  updateSensitiveDisease: (params: SensitiveDiseaseItem[]) => {
    return http.request<RequestResponse<any>>(
      "post",
      "/api/v1/hdl/app/tag/sensitiveDisease/update",
      { data: params }
    );
  }
};

// 敏感疾病项类型
export interface SensitiveDiseaseItem {
  name: string; // 疾病名称
  visibleScope: string; // 可见范围
  tagId?: number; // 标签ID
}

// 敏感疾病查询响应数据类型
export interface SensitiveDiseaseSearchData {
  pageNum: number; // 当前页码
  pageSize: number; // 每页大小
  total: number; // 总记录数
  pages: number; // 总页数
  list: SensitiveDiseaseItem[]; // 疾病列表
  emptyFlag: boolean; // 是否为空
}

// 查询参数类型
export interface SensitiveDiseaseSearchParams {
  pageNum: number; // 页码
  pageSize: number; // 每页大小
  name?: string; // 疾病名称
  visibleScope?: string; // 可见范围
}
